﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>选择批次备注</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
</head>
<body>
    <div class="ufcSectionStyle">
        <span class="ufcSectionSpanStyle">模板区域</span>
    </div>
    <span id="oldcomm" style="height: 20px; font-size: 15px;"></span>
    <table id="gdRecordInfo" class="easyui-datagrid" style="width: 100%; height: 450px"
        data-options="checkOnSelect:true,selectOnCheck:true">
    </table>
    <div class="ufcSectionStyle">
        <span class="ufcSectionSpanStyle">按钮区域</span>
    </div>
    <div style="margin-top: 3px">
        <a href="#" id="saveData" class="easyui-linkbutton" style="width: 100px; margin-left: 10px;">
            确定</a>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript">
    var tdata = [
     { "dname": "使用方", "dvalue": "" },
     { "dname": "代料单号", "dvalue": "" },
     { "dname": "毛坯超差单号", "dvalue": "" },
     { "dname": "型别", "dvalue": "" },
     { "dname": "分卡信息", "dvalue": "" },
     { "dname": "产品用途", "dvalue": "" },
     { "dname": "产品箱号", "dvalue": "" },
     { "dname": "例外放行审理单编号", "dvalue": "" },
     { "dname": "产品状态", "dvalue": "" },
     { "dname": "棒材顺序号", "dvalue": "" },
     { "dname": "试棒数量", "dvalue": "" },
     { "dname": "状态信息说明", "dvalue": "" },
      { "dname": "其他", "dvalue": "" }
    ];
    var page = {
        init: function () {
            var formdia = parent.$("#winFormDialog");
            var data = formdia.dialog('options');
            if (data.inParam.type != undefined && data.inParam.comments != "") {
                $('#oldcomm').text("[" + data.inParam.containername + "]原备注：" + data.inParam.comments);
            }
            this.bind();
        },
        //页面事件绑定
        bind: function () {
            $("#gdRecordInfo").datagrid({
                columns: [[
                 { field: 'ck', title: '选择', checkbox: true },
		         { field: 'dname', title: '', width: 150 },
                 { field: 'dvalue', title: '', width: 300,
                     formatter: function (value, row, index) {
                         if (row.dname == "使用方") {
                             return '<select id="gridtxt' + index + '" class="easyui-combobox" name="gridtxt' + index + '" style="width:290px;" editable="false">' +
                             '<option value=""></option><option value="空军使用">空军使用</option><option value="海军使用">海军使用</option><option value="外贸使用">外贸使用</option></select>'
                         } else {
                             return '<input id="gridtxt' + index + '" name="gridtxt' + index + '" class="easyui-textbox" style="width:290px">';
                         }
                     }
                 }
                 ]]
            });
            $("#gdRecordInfo").datagrid('loadData', tdata);
            $("#saveData").on("click", function () {
                var rows = $("#gdRecordInfo").datagrid('getChecked'); //获取所有勾选的行
                var resStr = "";
                for (var i = 0; i < rows.length; i++) {
                    var index = $("#gdRecordInfo").datagrid('getRowIndex', rows[i]); //获取改行的index
                    var content = $.trim($('input[name="gridtxt' + index + '"]').val());
                    if (content != "") {
                        resStr += rows[i].dname + ":" + $('input[name="gridtxt' + index + '"]').val() + ";"; //通过index对应name获取数据
                    }
                }
                var formdia = parent.$("#winFormDialog");
                var data = formdia.dialog('options');
                data.outParam = resStr;
                formdia.dialog('options', data);
                formdia.dialog('close')
            });
        }
    };
    page.init();
</script>
